package 蓝桥杯;

import java.util.Scanner;

public class year {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt();
        int y=sc.nextInt();
        int[] year=new int[y-x+1];
        int count=0;
        for(int i=x;i<=y;i++){
            if (isLeapYear(i)) {
                count++;
                year[count-1]=i;
            }
        }
        System.out.println(count);
        for(int i=0;i<count;i++){
            System.out.print(year[i]+" "); 
        }
    }

    public static boolean isLeapYear(int year){
        if(year%4==0&&year%100!=0||year%400==0){
            return true;
        }else{
            return false;
        }
    }
}
